package com.example.timmy.myapplication.ui.activity;

import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import com.example.timmy.myapplication.R;
import com.example.timmy.myapplication.widget.HorizontalProgressBar;
import com.example.timmy.myapplication.widget.TestView;

public class LineViewActivity extends AppCompatActivity {

    HorizontalProgressBar horizontalProgressBar;

    private Button mBtnStart;
    private TestView mTestView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_lineview);

        horizontalProgressBar = $(R.id.circle_progress_view);
        mBtnStart = $(R.id.btn_start);
        mTestView = $(R.id.textview);
        mTestView.setLevel(3);

        mBtnStart.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startAnimation();
            }
        });
    }

    private void startAnimation() {
        horizontalProgressBar.setProgressWithAnimation(100);
    }

    private <T extends View> T $(@IdRes int id) {
        return (T) findViewById(id);
    }



}
